using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AccessDataSourcePage : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {        
        gridView = new GridView();
        this.form1.Controls.Add(gridView);
        ShowCustomers();
    }

    GridView gridView;
    
    void ShowCustomers()
    {
        AccessDataSource acessDataSource;
        acessDataSource = new AccessDataSource();
        acessDataSource.DataFile =
        Server.MapPath(".") + "\\Northwind.mdb";
        acessDataSource.SelectCommandType =
        SqlDataSourceCommandType.Text;
        acessDataSource.SelectCommand =
        "select CustomerID,CompanyName, " +
        "ContactName,Address,City from Customers" ;        
        gridView.DataSource = acessDataSource;
        gridView.DataBind();

    }
}
